package com.dfbz.demo03_接口的小案例;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01 {
    public static void main(String[] args) {


        Student student=new Student();

        student.swim();
        student.eat();
        student.sleep();

        System.out.println("--------------");
        Singer singer=new Singer();
        singer.eat();
        singer.sleep();
        singer.dance();

    }
}

class Singer extends Person implements Danceable{
    public void dance(){
        System.out.println("跳了个芭蕾舞....");
    }
}

class Student extends Person implements Swimmable {
    public void swim() {
        System.out.println("狗刨式游泳....");
    }
}

// 跳舞接口
interface Danceable {

    void dance();
}

// 游泳接口
interface Swimmable {
    void swim();
}


class Person {

    private String name;
    private int age;

    public void eat() {
        System.out.println("吃饭...");
    }

    public void sleep() {
        System.out.println("睡觉...");
    }


    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}